package com.atguigu.ssyx.acl.controller;

import com.atguigu.ssyx.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 登录接口
 * @Author: Ian
 * @Date: 2023/9/25 01:29
 */
@RestController
@RequestMapping("/admin/acl/index")
@CrossOrigin  // 解决跨域问题
@Api(tags = "登录接口")
public class IndexController {

    /**
     * 登录功能
     * @return
     */
    @PostMapping("/login")
    @ApiOperation("登录功能")
    public Result login(){
        Map<String, String> map = new HashMap<>();
        map.put("token","123456");
        return Result.ok(map);
    }

    /**
     * 获取信息功能
     * @return
     */
    @GetMapping("/info")
    @ApiOperation("获取信息")
    public Result info(){
        Map<String, String> map = new HashMap<>();

        map.put("name","admin");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return Result.ok(map);
    }

    /**
     * 退出登录
     * @return
     */
    @PostMapping("/logout")
    @ApiOperation("退出登录")
    public Result logout(){
        return Result.ok(null);
    }

}
